package com.ken.base_http_library.http_api_impl

import io.reactivex.Observable
import io.reactivex.Scheduler
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

/**
 * @author by ken
 * Blog:
 * Date:2020/5/7
 * Description:将一些重复的操作提出来，放到父类以免Loader 里每个接口都有重复代码
 */
open class ObjectLoader {

    protected fun <T> observe(observable: Observable<T>): Observable<T> {

        return observable.subscribeOn(Schedulers.io())
            .unsubscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
    }

}